#!/bin/bash
echo "run begin"


pid=`ps -ef | grep hospital-upms-biz-1.0.0.jar | grep -v grep | awk '{print $2}'`
if [ -n "$pid" ]
then
   kill -9 $pid
fi

pid=`ps -ef | grep hospital-auth-1.0.0.jar | grep -v grep | awk '{print $2}'`
if [ -n "$pid" ]
then
   kill -9 $pid
fi

pid=`ps -ef | grep hospital-gateway-1.0.0.jar | grep -v grep | awk '{print $2}'`
if [ -n "$pid" ]
then
   kill -9 $pid
fi

pid=`ps -ef | grep hospital-pharmacy-biz-1.0.0.jar | grep -v grep | awk '{print $2}'`
if [ -n "$pid" ]
then
   kill -9 $pid
fi


pid=`ps -ef | grep hospital-psychology-biz-1.0.0.jar | grep -v grep | awk '{print $2}'`
if [ -n "$pid" ]
then
   kill -9 $pid
fi




#  admin
cd /root/.m2/repository/com/wyzy/hospital-upms-biz/1.0.0
BUILD_ID=dontKillMe nohup java -jar hospital-upms-biz-1.0.0.jar >>admin.log & 
sleep 10

# auth
cd /root/.m2/repository/com/wyzy/hospital-auth/1.0.0
BUILD_ID=dontKillMe nohup java -jar hospital-auth-1.0.0.jar >>auth.log &
sleep 10

# gateway
cd /root/.m2/repository/com/wyzy/hospital-gateway/1.0.0
BUILD_ID=dontKillMe nohup java -jar hospital-gateway-1.0.0.jar >>gateway.log &
sleep 10

# pharmacy
cd /root/.m2/repository/com/wyzy/hospital-pharmacy-biz/1.0.0
BUILD_ID=dontKillMe nohup java -jar hospital-pharmacy-biz-1.0.0.jar > /dev/null 2>&1 &
sleep 10

# psychology
cd /root/.m2/repository/com/wyzy/hospital-psychology-biz/1.0.0
BUILD_ID=dontKillMe nohup java -jar hospital-psychology-biz-1.0.0.jar > /dev/null 2>&1 &
sleep 10

echo "run success"